﻿using FluentAssertions;

using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;

namespace Shifter.WinRT.Tests
{
    [TestClass]
    public class ResolverTests
    {
        [TestMethod]
        public void WhenRegisteringATypeItShouldBeResolved()
        {
            var container = new ShifterContainer();
            container.AddType<ITestClass, TestClass>();

            var resolved = container.Resolve<ITestClass>();

            resolved.Should().BeOfType<TestClass>("because it was registered");
        }

        [TestMethod]
        public void WhenRegisteringATypeWithPropertyWithNoSetMethodItShouldBeResolved()
        {
            var container = new ShifterContainer();
            container.AddType<IExampleTextCreator, ExampleTextCreator>();

            var resolved = container.Resolve<IExampleTextCreator>();

            resolved.Should().BeOfType<ExampleTextCreator>("because it was registered");
        }

        [TestMethod]
        public void WhenRegisteringATypeWithPropertyWithNoGetMethodItShouldBeResolved()
        {
            var container = new ShifterContainer();
            container.AddType<ITestClassWithPropertyWithNoGetter, TestClassWithPropertyWithNoGetter>();

            var resolved = container.Resolve<ITestClassWithPropertyWithNoGetter>();

            resolved.Should().BeOfType<TestClassWithPropertyWithNoGetter>("because it was registered");
        }
    }
}
